//
//  settingCell.m
//  liangyi
//
//  Created by 张水 on 16/12/15.
//  Copyright © 2016年 yswh. All rights reserved.
//

#import "settingCell.h"

@implementation settingCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self){
        [self setup];
    }
    return  self;
}

-(void)setSetModel:(settingModel *)setModel{
    _setModel = setModel;
    self.desImage.image = [UIImage imageNamed:setModel.icon];
    self.desName.text = setModel.title;
}

-(void)setup{
    
    WeakSelf(wk)
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    UIView *line = [UIView new];
    line.backgroundColor = [UIColor ColorWithHex:@"#ecf1f2"];
    [self.contentView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(wk);
        make.bottom.right.equalTo(wk);
        make.height.equalTo(@1);
    }];
    
    self.desImage = [[UIImageView alloc]init];
    self.desImage.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:self.desImage];
    [self.desImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(wk).offset(20);
        make.top.equalTo(wk).offset(20);
        make.width.height.equalTo(@15);
    }];
    
    self.desName = [[UILabel alloc]init];
    self.desName.textColor = [UIColor ColorWithHex:@"#686868"];
    self.desName.font = [UIFont systemFontOfSize:15];
    self.desName.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.desName];
    [self.desName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.desImage.mas_right).offset(10);
        make.centerY.equalTo(self.desImage.mas_centerY);
    }];
    
    
}
@end
